/*******************************************************************************
 * Name    : SplashScreenController.hpp
 * Date    : 01-14-2015
 * Author  : Sylvain Nieuwlandt -- nicholas.rush.developper@gmail.com
 ******************************************************************************/
#ifndef SPLASHSCREENCONTROLLER_HPP
#define SPLASHSCREENCONTROLLER_HPP

#include <stdlib.h>

#include <kino/KiObject.hpp>
#include <kino/KiLogger.hpp>
#include <kino/KiBufferedImage.hpp>
#include <kino/KiList.hpp>
#include <kino/KiListIterator.hpp>
#include <kino/exception/FileNotFoundException.hpp>
#include <kino/exception/DirectoryNotExistsException.hpp>
#include <kino/stream/KiInputStringStream.hpp>
#include <kino/stream/KiInputByteStream.hpp>
#include <kino/system/KiDirectory.hpp>
#include <kino/system/KiSystem.hpp>
#include <kino/wrapper/KiString.hpp>


#include <Managers/ConfigurationManager.hpp>
#include <Managers/LabelManager.hpp>
#include <Managers/CardsImageManager.hpp>
#include <Views/MainWindow/SplashScreenView.hpp>

#define CONFIG_FILE "ressources/config.nrproperties"
#define LABEL_FILE "ressources/label.nrproperties"
#define IMAGES_PATH "images.path"
#define IMAGES_EXTENSION "images.extension"

/**
 * This class control the Splash Screen of the application.
 */
class SplashScreenController : public KiObject {
public:
  /**
   * Constructor of the class.
   *
   * Create a new instance of SplashScreenController
   */
  SplashScreenController();

  /**
   * Destructor of the class.
   *
   * Destroy the calling instance.
   */
  virtual ~SplashScreenController();
  
  /**
   * Initialize the splash screen, and load the global components of the 
   * application.
   *
   * Display the splash screen in the GUI, load the global components (like
   * the cards' images, the messages...), and then close the splash screen.
   */
  virtual void showAndLoadComponents();
  
private:
  void loadGeneralComponents();
  void loadConfiguration(KiString exeDirectory);
  void loadLabel(KiString exeDirectory);
  void loadCardsImages(KiString exeDirectory);
  
  /**
   * Logger instance 
   */
  static KiLogger* LOGGER;
};

#endif
